﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Servico;

public partial class InfoCliente : System.Web.UI.Page
{
    Service1 servico = new Service1();

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Email"] != null)
        {
            System.Data.DataTable dttblData = servico.procurarCliente(Session["email"].ToString());
            dgrData.DataSource = dttblData;
            dgrData.DataBind();
        }
        else
        {
            Session["Erro"] = "Por favor autentique-se!";
            Response.Redirect("Home.aspx");
        }
        MensagemErro();
    }

    protected void MensagemErro()
    {
        if (Session["Erro"] != null)
        {
            Literal lit = new Literal();
            lit.Text = "<ul id=\"menu2\"><li>" + Session["Erro"].ToString() + "</li></ul>";
            PanelMsg.Controls.Add(lit);
            Session["Erro"] = null;
        }
        if (Session["Sucesso"] != null)
        {
            Literal lit = new Literal();
            lit.Text = "<ul id=\"menu3\"><li>" + Session["Sucesso"].ToString() + "</li></ul>";
            PanelMsg.Controls.Add(lit);
            Session["Sucesso"] = null;
        }
    }
}